#include "mytabbar.h"
#include <QPainter>
#include <QStyleOptionTab>
#include <QRect>
MyTabBar::MyTabBar(QWidget *parent)
    : QTabBar{parent}
{}

void MyTabBar::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);

    QPainter painter(this);
    QStyleOptionTab opt;

    for (int i = 0; i < count(); ++i) {
        initStyleOption(&opt, i);
        QRect rect = tabRect(i);

        // Adjust tabRect for left alignment
        opt.rect = rect;
        opt.rect.moveLeft(0); // move tab to the left edge

        style()->drawControl(QStyle::CE_TabBarTab, &opt, &painter, this);
    }
}
